#include <bits/stdc++.h>
// 2025/03/06
// tag: 
// Author: Forever
using namespace std;

using int64 = int64_t;

int n, t, book[100001];

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> t;
    for (int i = 1; i <= n; i++)
        cin >> book[i];
    for (int i = 1; i <= n; i++)
        book[i] += book[i - 1];
    int ans = 0;
    for (int i = 1; i <= n; i++){
        int len = upper_bound(book + i, book + n + 1, book[i - 1] + t) - (book + i);
        ans = max(ans, len);
    }
    cout << ans << endl;
    return 0;
}